import request from '../utils/request'

// 获取验证码
export const getRcode = data => {
  return request({
    url: '/sendsms',
    method: 'POST',
    data
  })
}

// 注册
export const register = data => {
  return request({
    url: '/register',
    method: 'POST',
    data
  })
}

// 获取用户信息
export const getUserInfo = () => {
  return request({
    url: '/info'
  })
}

// 退出
export const logout = () => {
  return request({
    url: '/logout'
  })
}

// 获取用户列表
export const getUserList = data => {
  return request({
    url: '/user/list',
    params: data
  })
}

// 更改用户状态
export const changeStatus = id => {
  return request({
    url: '/user/status',
    method: 'POST',
    data: { id }
  })
}

// 删除用户
export const delUser = id => {
  return request({
    url: '/user/remove',
    method: 'POST',
    data: { id }
  })
}

// 新增用户
export const addUser = data => {
  return request({
    url: '/user/add',
    method: 'POST',
    data
  })
}

// 修改用户
export const editUser = data => {
  return request({
    url: '/user/edit',
    method: 'POST',
    data
  })
}
